package com.example.demo.util;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;

public class GsonUtils {
    public static  Object fromJson(String str) {
        Gson gson = new GsonBuilder().setPrettyPrinting().create();
        return gson.fromJson(str, Object.class);
    }

    public static String getVal(String json, String name) {
        JsonObject jsonObject = new Gson().fromJson(json, JsonObject.class);
        return jsonObject.get(name).getAsString();
    }
}
